package com.atguigu.gmall.payment.client;

import com.atguigu.gmall.model.payment.PaymentInfo;
import com.atguigu.gmall.payment.client.impl.PaymentFeignClientImpl;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.ResponseBody;

@FeignClient(value = "service-payment", fallback = PaymentFeignClientImpl.class)
public interface PaymentFeignClient {
    // 根据订单Id关闭订单
    @GetMapping("/api/payment/alipay/closePay/{orderId}")
    @ResponseBody
    boolean closePay(@PathVariable Long orderId);

    // 查询支付宝是否有交易记录
    @GetMapping("/api/payment/alipay/checkPayment/{orderId}")
    @ResponseBody
    boolean checkPayment(@PathVariable Long orderId);

    // 查询本地数据库是否有 PaymentInfo
    @GetMapping("/api/payment/alipay/getPaymentInfo/{outTradeNo}")
    @ResponseBody
    PaymentInfo getPaymentInfo(@PathVariable String outTradeNo);
}
